<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>定时器跳转百度</title>
	<style type="text/css">
		*{
			margin: 0;
			padding: 0;
			list-style-type: none;
			text-decoration: none; 
		}
		#box{
			width: 100px;
			height: 100px;
			margin: 50px auto;
			border: 1px solid #000;
			text-align: center;
			line-height: 100px;
		}
	</style>
</head>
<body>

	<div id="box">3</div>
	<script type="text/javascript">
		function dom(id){
			return document.getElementById(id);
		}
		var oBox = dom("box"),
		time = oBox.innerHTML * 1;
		var a = setInterval(function(){
			time--;
			oBox.innerHTML = time;
			//要用==
			if(time == 1){
				clearInterval(a);
				window.location.href="https://www.baidu.com";
			}
		},1000);

	</script>
</body>
</html>